<?php $divId = $this->uuid('div', $this->here); ?>
<div id="<?php echo $divId; ?>">
    <?php if (empty($this->data['CustProductSite']['id'])) : // ถ้า Product นี้ยังไม่มี Stock code?>
    <div class="fail-flash">
        No product information available. <br />
        If you want to dispatch this product, Please contract VMI section at <?php echo $this->requestAction('system_preferences/get/company_name'); ?><br />
        Tel. <?php echo $this->requestAction('system_preferences/get/tel'); ?>
    </div>
    <?php else : ?>
    <fieldset>
        <legend>Product Information</legend>
        <table>
            <tr>
                <td width="100px"><?php echo $form->label('CustProductSite.stock_code') ?></td>
                <td width="230px"><?php echo $this->data['CustProductSite']['stock_code']; ?></td>
                <td width="100px"><?php echo $form->label('CustProductSite.price', 'Latest Price') ?></td>
                <td><?php echo number_format($this->data['CustProductSite']['price'], 2); ?> Baht</td>
            </tr>
        </table>
    </fieldset>

    <fieldset>
        <legend>Application Information</legend>
        <table>
            <tbody>
                <tr>
                    <td width="80px"><?php echo $form->label('CustProductSite.mc', 'M/C') ?></td>
                    <td width="250px"><?php echo $this->data['CustProductSite']['mc']; ?></td>
                    <td width="120px"><?php echo $form->label('CustProductSite.fluid', 'Fluid') ?></td>
                    <td><?php echo $this->data['CustProductSite']['fluid']; ?></td>
                </tr>
                <tr>
                    <td><?php echo $form->label('CustProductSite.temp', 'Temp') ?></td>
                    <td><?php echo $this->data['CustProductSite']['temp']; ?></td>
                    <td><?php echo $form->label('CustProductSite.pressure', 'Pressure') ?></td>
                    <td><?php echo $this->data['CustProductSite']['pressure']; ?></td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <fieldset>
        <legend>Moving Information</legend>
        <table>
            <tbody>
                <tr>
                    <td width="200px"><?php echo $form->label('CustProductSite.ex_stock', 'Ex-stock before Consigned') ?></td>
                    <td width="70px"><?php echo $this->data['CustProductSite']['ex_stock']; ?></td>
                    <td width="50px">
                            <?php echo $this->data['Product']['Unit']['title']; ?>
                    </td>
                    <td width="200px"><?php echo $form->label('CustProductSite.critical_part', 'Critical part') ?></td>
                    <td><?php echo ($this->data['CustProductSite']['critical_part'])? "Yes" : "No"; ?></td>
                </tr>
                <tr>
                    <td><?php echo $form->label('CustProductSite.min_stock', 'Min Stock') ?></td>
                    <td class="text-right"><?php echo $this->data['CustProductSite']['min_stock']; ?></td>
                    <td><?php echo $this->data['Product']['Unit']['title']; ?></td>
                    <td><?php echo $form->label('CustProductSite.critical_mc', 'Critical M/C') ?></td>
                    <td><?php echo ($this->data['CustProductSite']['critical_mc'])? "Yes" : "No"; ?></td>
                </tr>
                <tr>
                    <td><?php echo $form->label('CustProductSite.max_stock', 'Max stock') ?></td>
                    <td class="text-right"><?php echo $this->data['CustProductSite']['max_stock']; ?></td>
                    <td><?php echo $this->data['Product']['Unit']['title']; ?></td>
                    <td><?php echo $form->label('CustProductSite.cycle_time', 'Cycle time') ?></td>
                    <td><?php echo !empty($this->data['CustProductSite']['cycle_time'])? $this->data['CustProductSite']['cycle_time']: 'N/A' ?></td>
                    <td>
                            <?php if (!empty($this->data['CyclePeriod']['title']) && !empty($this->data['CustProductSite']['cycle_time']))
                                echo $this->data['CyclePeriod']['title'] ?>
                    </td>
                </tr>
                <tr>
                    <td><?php echo $form->label('CustProductSite.current_stock', 'Current Stock') ?></td>
                    <td class="text-right"><?php echo $this->data['CustProductSite']['current_stock']; ?></td>
                    <td><?php echo $this->data['Product']['Unit']['title']; ?></td>
                    <td><?php echo $form->label('CustProductSite.shortest_life_cycle', 'Shortest Life Cycle') ?></td>
                    <td>
                            <?php if (!empty($this->data['ShortestPeriod']['title']) && !empty($this->data['CustProductSite']['shortest_life_cycle']))
                                echo $this->data['ShortestPeriod']['title'] ?>
                    </td>
                </tr>
                <tr>
                    <td><?php echo $form->label('CusProductSite.last_stock_in_date', 'Last Stock in Date'); ?></td>
                    <td class="text-right"><?php echo !empty($this->data['CustProductSite']['last_stock_in_date'])? $this->data['CustProductSite']['last_stock_in_date']: '-' ?></td>
                    <td>&nbsp;</td>
                    <td><?php echo $form->label('CustProductSite.maintenance_plan', 'Maintenance plan(every)') ?></td>
                    <td>
                            <?php if (!empty($this->data['MaintenancePeriod']['title']) && !empty($this->data['CustProductSite']['maintenance_plan']))
                                echo $this->data['MaintenancePeriod']['title'] ?>
                    </td>
                </tr>
                <tr>
                    <td><?php echo $form->label('CusProductSite.last_stock_out_date', 'Last Stock out Date'); ?></td>
                    <td class="text-right"><?php echo !empty($this->data['CustProductSite']['last_stock_out_date'])? $this->data['CustProductSite']['last_stock_out_date']: '-' ?></td>
                    <td>&nbsp;</td>
                    <td><?php echo $form->label('CustProductSite.complete_consignment_date', 'Complete consignment on') ?></td>
                    <td>&nbsp;</td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <?php endif; ?>
</div>